package com.cyandpos.pad.tradedetails.adapter;

import android.app.AlertDialog;
import androidx.annotation.Nullable;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.cyandpos.pad.R;
import com.cyandpos.pad.activity.MainActivity;
import com.cyandpos.pad.activity.OrderqueryActivity;
import com.cyandpos.pad.posdata.Goods;
import com.cyandpos.pad.posdata.Order;
import com.cyandpos.pad.posdata.SubTicketItem;
import com.cyandpos.pad.utils.MoneyUtils;
import com.cyandpos.pad.utils.ToastUtils;

import java.util.List;

public class OrderqueeryGoodsListAdapter extends BaseQuickAdapter<Order, BaseViewHolder> {
    private OrderqueryActivity activity;
    private String content;

    public OrderqueeryGoodsListAdapter(int layoutResId, @Nullable List<Order> data, OrderqueryActivity activity) {
        super(layoutResId, data);
        this.activity = activity;
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder,final Order order) {
        LinearLayout llGoodInfo = baseViewHolder.getView(R.id.ll_item_goodInfo);
        TextView tvInx = baseViewHolder.getView(R.id.tv_sale_good_ticket_inx);
        TextView tvCoderq = baseViewHolder.getView(R.id.tv_sale_good_rq);
        TextView tvorder = baseViewHolder.getView(R.id.tv_sale_good_order);
        TextView tvPrice = baseViewHolder.getView(R.id.tv_sale_good_price);
        TextView tvDiscount = baseViewHolder.getView(R.id.tv_sale_good_discountMoney);
        TextView tvSaleMoney = baseViewHolder.getView(R.id.tv_sale_good_saleMoney);
        TextView tvSaleMname = baseViewHolder.getView(R.id.tv_sale_person_name);

        tvInx.setText((baseViewHolder.getAdapterPosition()+1)+"");
        tvCoderq.setText(order.getOrderTime());
        tvorder.setText(order.getOrderNo());
        tvPrice.setText(MoneyUtils.getMoneyStr(MoneyUtils.getMoneyInt(order.getTotalAmount())));
        tvSaleMname.setText(" ");
        tvDiscount.setText(MoneyUtils.getMoneyStr(MoneyUtils.getMoneyInt("   "+order.getTotalDiscount())));//折扣
        tvSaleMoney.setText(MoneyUtils.getMoneyStr(MoneyUtils.getMoneyInt("   "+order.getTotalAmount())));
    }

    @Nullable
    @Override
    public Order getItem(int position) {

        return super.getItem(position);

    }
}
